// 微信小程序API接口封装
// 模态对话框API
/**
 * promise 形式 showModal
 * @param {object} param0 参数
 * @returns
 */
export const showModal = ({ content }) => {
  return new Promise((resolve, reject) => {
    wx.showModal({
      title: '提示',
      content: content,
      success: (res) => resolve(res),
      fail: reject
    })
  })
}
// 消息提示框API
/**
 * promise 形式 showToast
 * @param {object} param0 参数
 * @returns
 */
export const showToast = ({ title, icon }) => {
  return new Promise((resolve, reject) => {
    wx.showToast({
      title: title,
      icon: icon || 'none',
      mask: true,
      success: (res) => resolve(res),
      fail: reject
    })
  })
}
// 微信登录API
/**
 * promise 形式 login
 */
export const login = () => {
  return new Promise((resolve, reject) => {
    wx.login({
      setTimeout: 10000,
      success: (res) => resolve(res),
      fail: reject
    })
  })
}
